<?php
session_start();
?>
<?php

require "lib/db.php";
require "lib/category-function.php";

if(isset($_POST['btnAddCategory'])){
	$categoryName = $_POST['txtCategoryName'];
	$description = $_POST['taDescription'];
	addCategory($categoryName,$description);
	header("location:list-category.php");
}

if(isset($_POST['btnEditCategory'])){
	$categoryName = $_POST['txtCategoryName'];
	$description = $_POST['taDescription'];
	$categoryID = $_POST['categoryID'];
	settype($categoryID,"int");
	editCategory($categoryName,$description,$categoryID);
	header("location:list-category.php");
}
?>